package cn.sumpu.app.guoguojie.biz.impl;

import java.util.List;
import java.util.Map;

import cn.sumpu.app.guoguojie.biz.CommentBiz;
import cn.sumpu.app.guoguojie.dao.CommentDao;
import cn.sumpu.app.guoguojie.domain.Comment;
import cn.sumpu.app.guoguojie.domain.Ext.CommentExt;
import cn.sumpu.app.guoguojie.exception.AppBusinessException;
import cn.sumpu.app.guoguojie.util.IdGenerator;

public class CommentBizImpl implements CommentBiz {
	private CommentDao commentDao;

	public void insert(Comment comment) throws AppBusinessException {
		comment.setIdentifier(IdGenerator.createIdentifier());
		commentDao.insert(comment);
	}

	@Override
	public List<CommentExt> getCommentList(Map<String, Object> map)
			throws AppBusinessException {
		
		return commentDao.getCommentList(map);
	}

	public void setCommentDao(CommentDao commentDao) {
		this.commentDao = commentDao;
	}

	@Override
	public void updateComment(Comment comment) throws AppBusinessException {
		commentDao.updateComment(comment);

	}

	@Override
	public void deleteCommentById(String id) throws AppBusinessException {
		commentDao.deleteCommentById(id);

	}

	@Override
	public Comment getCommentById(String id) throws AppBusinessException {
		return commentDao.getCommentById(id);
	}

	public List<CommentExt> getFeedCommentExtList(Map<String, Object> map)
			throws AppBusinessException {
		return commentDao.getFeedCommentExtList(map);
	}

	@Override
	public int getCommentCountList(String commentId)
			throws AppBusinessException {
		
		return commentDao.getCommentCountList(commentId);
	}

}
